<?php 
include '../header.php';
$menus=sql_query ("select * FROM `menu` WHERE address='$a'");
if (mysql_num_rows($menus)>=1) 
{
	$menu=mysql_fetch_array($menus);
	$menuid=$menu['id'];
	$pages=sql_query ("select * FROM `page` WHERE menu='$menuid' AND access=1");
if (mysql_num_rows($pages)>=1) 
{
	$i=1;
	while ($page=mysql_fetch_array($pages)) {
	echo $i.': <strong style="background-color:#EED" class="big"><a href="/page/'.$page['address'].'">'.$page['title'].'</a></strong><br><br />
	<p style="margin-left:50px">'.$page['shorttext'].'</p><a href="/page/'.$page['address'].'" class="right">Подробнее…</a><br />'; 
	$i++;
}}

if ($auth==1) {
$pages=sql_query ("select * FROM `page` WHERE menu='$menuid' AND access=2");
if (mysql_num_rows($pages)>=1) 
{
	$i=1;
	while ($page=mysql_fetch_array($pages)) {
	echo $i.': <strong style="background-color:#FFD" class="big"><a href="/page/'.$page['address'].'">'.$page['title'].'</a></strong><br><br />
	<p style="margin-left:50px">'.$page['shorttext'].'</p><a href="/page/'.$page['address'].'" class="right">Подробнее…</a><br />'; 
	$i++;
}}}

if ($admin=='admin') {
$pages=sql_query ("select * FROM `page` WHERE menu='$menuid' AND access=100");
if (mysql_num_rows($pages)>=1) 
{
	$i=1;
	while ($page=mysql_fetch_array($pages)) {
	echo $i.': <strong style="background-color:#BBB" class="big"><a href="/page/'.$page['address'].'">'.$page['title'].'</a></strong><br><br />
	<p style="margin-left:50px">'.$page['shorttext'].'</p><a href="/page/'.$page['address'].'" class="right">Подробнее…</a><br />'; 
	$i++;
}}}


	
	} 
else { header('Location: /error/404'); 
}
include '../footer.php';
?>